<% if collection_item %>
<tr id="collection_item_<%= collection_item.id %>">
<th scope="row">
  <%= form_for(:collection_item, collection_item, :url => {:controller => "collection_items", :action => "update"}) do |form| %>
    <%= form.hidden_field :id %><%= form.hidden_field :collection_id %>
    <%= link_to(
      collection_item.item_type == "Bookmark" ? t('.collection_items.bookmark', :default => "Bookmark for %{title}", :title => collection_item.title) : 
      collection_item.title + (!collection_item.item.posted? ? t('.collection_items.draft', :default => "(draft)") : ""), collection_item.item) %>
</th>
<% unless @user %>
  <!-- collection view -->
  <td><%= collection_item.item_creator_names %></td>
  <td><%= collection_item.item_creator_pseuds.map {|pseud| collection_item.collection.user_is_posting_participant?(pseud.user) ? "Y" : "N"}.join(", ") %></td>
  <td><%= CollectionItem::LABEL[collection_item.user_approval_status] %></td>
  <td><%= form.select(:collection_approval_status, CollectionItem::APPROVAL_OPTIONS) %></td>
  <% if @collection.gift_exchange? %>
    <td><%= collection_item.recipients %></td>
  <% end %>
  <% if @collection.unrevealed? %>
    <td><%= form.check_box :unrevealed %></td>
  <% end %>
  <% if @collection.anonymous? %>
    <td><%= form.check_box :anonymous %></td>
  <% end %>
<% else %>
  <!-- user version -->
  <td><%= link_to collection_item.collection.title, collection_path(collection_item.collection) %></td>
  <td><%=h collection_item.collection.user_is_posting_participant?(@user) ? "Y" : "N" %>
  <td><%= form.select(:user_approval_status, CollectionItem::APPROVAL_OPTIONS) %><%= hidden_field_tag :user_id, @user.login %></td>
  <td><%= CollectionItem::LABEL[collection_item.collection_approval_status] %></td>
<% end %>

<td><%= collection_item.item.respond_to?(:word_count) ? collection_item.item.word_count : t('.collection_items.na', :default => "N/A") %></td>
<td><%= collection_item.item_date.to_date %></td>

<td class="submit button">
  <%= form.submit t('.forms.update', :default => "Update") %>
  <% end %> 
  <%= button_to t('.item_remove', :default => "Remove"), 
                @user ? user_collection_item_path(@user, collection_item) : collection_item_path(collection_item.collection, collection_item), 
                :confirm => t('.item_confirm_delete', :default => 'Are you certain you want to entirely remove %{item} from the collection?', 
                :item => collection_item.item_type == "Bookmark" ? 
                t('.collection_items.bookmark', :default => "Bookmark for %{title}", :title => collection_item.item.bookmarkable.title) : 
                collection_item.item.title), 
                :method => :delete %>
</td>
</tr>
<% end %>
